package com.kedi.usercenter.config;


import com.kedi.usercenter.pcauthority.service.Authority;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @Component：被spring容器管理
 * @Order(1):如果多个自定义ApplicationRunner，用来标明执行顺序
 * @author Zyred
 */
@Order(1)
@Component
public class MyApplicationRunner implements CommandLineRunner {
	private static final Logger LOG =  LoggerFactory.getLogger(MyApplicationRunner.class);

	@Autowired
	Authority authority;

	@Override
	public void run(String... args){
		try {
			authority.loadAuthorityToRedies();
		} catch (Exception e) {
			LOG.info("启动加载权限失败：" + e.getMessage());
		}
	}
}
